home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.08 Aug 89 / PREC Code / InitTheMenus.p < prev    next >
Encoding:
Text File  |  1989-06-10  |  1.5 KB  |  46 lines  |  [TEXT/PJMM]

  1. unit  InitTheMenus;
  2.  
  3. {File name:  InitTheMenus.p}
  4. {Function: Pull in menu lists from a resource file.}
  5. {          This procedure is called once at program start.}
  6. {          AppleMenu is the handle to the Apple menu, it is also}
  7. {          used in the procedure that handles menu events.}
  8. {History: 6/10/89 Original by Prototyper.   }
  9. {                       }
  10. interface
  11.  
  12.     procedure Init_My_Menus;            {Initialize the menus}
  13.  
  14.     var
  15.         AppleMenu:MenuHandle;           {Menu handle}
  16.         M_File:MenuHandle;              {Menu handle}
  17.         M_Edit:MenuHandle;              {Menu handle}
  18.  
  19. implementation
  20.  
  21.     procedure Init_My_Menus;            {Initialize the menus}
  22.     const
  23.         Menu1 = 1001;                   {Menu resource ID}
  24.         Menu2 = 1002;                   {Menu resource ID}
  25.         Menu3 = 1003;                   {Menu resource ID}
  26.  
  27.     begin                               {Start of Init_My_Menus}
  28.         ClearMenuBar;                   {Clear any old menu bars}
  29.  
  30.         { This menu is the APPLE menu, used for About and desk accessories.}
  31.         AppleMenu := GetMenu(Menu1);{Get the menu from the resource file}
  32.         InsertMenu (AppleMenu,0);       {Insert this menu into the menu bar}
  33.         AddResMenu(AppleMenu,'DRVR');{Add in DAs}
  34.  
  35.         M_File := GetMenu(Menu2);       {Get the menu from the resource file}
  36.         InsertMenu (M_File,0);          {Insert this menu into the menu bar}
  37.  
  38.         M_Edit := GetMenu(Menu3);       {Get the menu from the resource file}
  39.         InsertMenu (M_Edit,0);          {Insert this menu into the menu bar}
  40.  
  41.         DrawMenuBar;                    {Draw the menu bar}
  42.  
  43. end;                                    {End of procedure Init_My_Menus}
  44.  
  45. end.                                    {End of this unit}
  46.